using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace XCode.Membership
{
    /// <summary>小说章节目录</summary>
    [Serializable]
    [DataObject]
    [Description("小说章节目录")]
    [BindIndex("IX_TChaperList_Name", false, "Name")]
    [BindIndex("IX_TChaperList_UpdateTime", false, "UpdateTime")]
    [BindTable("TChaperList", Description = "小说章节目录", ConnName = "XSConn", DbType = DatabaseType.None)]
    public partial class TChaperList
    {
        #region 属性
        private Int64 _ID;
        /// <summary>编号</summary>
        [DisplayName("编号")]
        [Description("编号")]
        [DataObjectField(true, false, false, 0)]
        [BindColumn("ID", "编号", "")]
        public Int64 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }

        private Int64 _SourceID;
        /// <summary>名称</summary>
        [DisplayName("名称")]
        [Description("名称")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("SourceID", "名称", "")]
        public Int64 SourceID { get => _SourceID; set { if (OnPropertyChanging("SourceID", value)) { _SourceID = value; OnPropertyChanged("SourceID"); } } }

        private String _Name;
        /// <summary>名称</summary>
        [DisplayName("名称")]
        [Description("名称")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn("Name", "名称", "", Master = true)]
        public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }

        private String _BaseUrl;
        /// <summary>源地址</summary>
        [DisplayName("源地址")]
        [Description("源地址")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("BaseUrl", "源地址", "")]
        public String BaseUrl { get => _BaseUrl; set { if (OnPropertyChanging("BaseUrl", value)) { _BaseUrl = value; OnPropertyChanged("BaseUrl"); } } }

        private String _Url;
        /// <summary>url地址</summary>
        [DisplayName("url地址")]
        [Description("url地址")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Url", "url地址", "")]
        public String Url { get => _Url; set { if (OnPropertyChanging("Url", value)) { _Url = value; OnPropertyChanged("Url"); } } }

        private DateTime _UpdateTime;
        /// <summary>更新时间</summary>
        [DisplayName("更新时间")]
        [Description("更新时间")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("UpdateTime", "更新时间", "")]
        public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }

        private String _Remark;
        /// <summary>备注</summary>
        [DisplayName("备注")]
        [Description("备注")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn("Remark", "备注", "")]
        public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ID": return _ID;
                    case "SourceID": return _SourceID;
                    case "Name": return _Name;
                    case "BaseUrl": return _BaseUrl;
                    case "Url": return _Url;
                    case "UpdateTime": return _UpdateTime;
                    case "Remark": return _Remark;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ID": _ID = value.ToLong(); break;
                    case "SourceID": _SourceID = value.ToLong(); break;
                    case "Name": _Name = Convert.ToString(value); break;
                    case "BaseUrl": _BaseUrl = Convert.ToString(value); break;
                    case "Url": _Url = Convert.ToString(value); break;
                    case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
                    case "Remark": _Remark = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得小说章节目录字段信息的快捷方式</summary>
        public partial class _
        {
            /// <summary>编号</summary>
            public static readonly Field ID = FindByName("ID");

            /// <summary>名称</summary>
            public static readonly Field SourceID = FindByName("SourceID");

            /// <summary>名称</summary>
            public static readonly Field Name = FindByName("Name");

            /// <summary>源地址</summary>
            public static readonly Field BaseUrl = FindByName("BaseUrl");

            /// <summary>url地址</summary>
            public static readonly Field Url = FindByName("Url");

            /// <summary>更新时间</summary>
            public static readonly Field UpdateTime = FindByName("UpdateTime");

            /// <summary>备注</summary>
            public static readonly Field Remark = FindByName("Remark");

            static Field FindByName(String name) => Meta.Table.FindByName(name);
        }

        /// <summary>取得小说章节目录字段名称的快捷方式</summary>
        public partial class __
        {
            /// <summary>编号</summary>
            public const String ID = "ID";

            /// <summary>名称</summary>
            public const String SourceID = "SourceID";

            /// <summary>名称</summary>
            public const String Name = "Name";

            /// <summary>源地址</summary>
            public const String BaseUrl = "BaseUrl";

            /// <summary>url地址</summary>
            public const String Url = "Url";

            /// <summary>更新时间</summary>
            public const String UpdateTime = "UpdateTime";

            /// <summary>备注</summary>
            public const String Remark = "Remark";
        }
        #endregion
    }
}